<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript" src="${ctx }/static/ckeditor/ckeditor.js"></script>
<jsp:include page="/common.jsp"></jsp:include>
<script type="text/javascript">
	function toSubmit(){
		var editor = CKEDITOR.instances.editor_kama;
		//alert(editor.getData());
		$('input[name="content"]').val(editor.getData());
		//form_submit('system/template?save');
		$('#form').submit();
	}
	$(function(){
		selectItem('status','${t.status}','status');
	});
</script>
</head>
<body>
	${title }
	<form action="template?save" method="post" class="form-inline" id="form">
		<input type="hidden" name="id" value="${t.id }">
		<input type="hidden" name="content">
	
		<label class="control-label">名称:</label>
		<input type="text" name="name" class="input-medium" value="${t.name }">
		<label class="control-label">状态:</label>
		<select name="status" id="status">
                    </select>

		<textarea cols="80" id="editor_kama" name="editor_kama" rows="10">${t.content }</textarea>
			<script type="text/javascript">
			//<![CDATA[

				CKEDITOR.replace( 'editor_kama',
					{
						skin : 'kama'
					});

			//]]>
			</script>
			 <div class="control-group">
                <div class="controls">
                    <c:if test="${status==view}">
						<input type="button" onclick="toSubmit()" class="btn btn-primary" value="保存">
	                    </c:if>
                    <a class="btn btn-primary" onclick="go('system/template?list')">返回</a>
                </div>
            </div>
	</form>
</body>
</html>